package worktable

import (
	"time"

	pslog "gitee.com/xuesongtao/ps-log"
	"github.com/gogf/gf/frame/g"
)

var (
	IsTest = g.Cfg().GetBool("business.isTest") // 是否为测试环境
	plg    *pslog.PsLog
)

func InitPlg() {
	// 设置 logger
	pslog.SetLogger(g.Log())
	// pslog.PrintFilePool(false)

	var err error
	plg, err = pslog.NewPsLog(
		pslog.WithAsync2Tos(),
		pslog.WithCleanUpTime(12*time.Hour),
		pslog.WithTaskPoolSize(20),
	)
	if err != nil {
		panic(err)
	}
	if err := plg.TailLogs(); err != nil {
		panic(err)
	}

	StartCollectWatch()
}
